Skip to content

[pluggable monitor] add --silent and --config flags #1497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

cmaglie
Copy link
Member

@cmaglie cmaglie commented Oct 5, 2021

Please check if the PR fulfills these requirements

  • The PR has no duplicates (please search among the Pull Requests
    before creating one)
  • The PR follows
    our contributing guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)
  • UPGRADING.md has been updated with a migration guide (for breaking changes)
  • What kind of change does this PR introduce?
    This PR adds two flags to the monitor command of the CLI:
  1. --config/-c allows to set configuration of the monitor port before opening for example:
$ ./arduino-cli monitor -p /dev/ttyACM0 -c 115200,None,8,1
Set baudrate to 115200
Set parity to None
Set bits to 8
Set stop_bits to 1
Connected to /dev/ttyACM0! Press CTRL-C to exit.
HELLO 33833
HELLO 33834
HELLO 33835
HELLO 33836
HELLO 33837
HELLO 33838
HELLO 33839
HELLO 33840

The available parameters and values can be obtained with the --describe flag.
If an option is ambiguous it can be explicitly set using the configuration setting id followed by = and the desired setting value for example:

$ ./arduino-cli monitor -p /dev/ttyACM0 --config baudrate=115200,stop_bits=1
  1. --silent/-s will set the CLI in silent mode and will print only the output incoming from the port. This option is enabled automatically when the output of the CLI is redirected to a file but it can be forced with the -s flag if the autodetection do not work for some reason.
$ ./arduino-cli monitor -p /dev/ttyACM0 -c 9600,None,8,1 -s
HELLO 35574
HELLO 35575
HELLO 35576
HELLO 35577
HELLO 35578
^C
$ ./arduino-cli monitor -p /dev/ttyACM0 -c 9600,None,8,1 > test.log
^C
$ cat test.log 
HELLO 35615
HELLO 35616
HELLO 35617
HELLO 35618
HELLO 35619
HELLO 35620
HELLO 35621
HELLO 35622
HELLO 35623

@cmaglie cmaglie requested a review from silvanocerza October 5, 2021 17:11
Copy link
Contributor

@silvanocerza silvanocerza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small changes to make.

* rename --silent to --quiet
* removed useless 'settings' variable
* translation string for "Monitor port settings" in CLI mode
@cmaglie cmaglie force-pushed the pluggable-monitor-flags branch from 531e06b to 34b629a Compare October 6, 2021 10:32
@cmaglie cmaglie merged commit fd14435 into arduino:feature/pluggable-monitor Oct 6, 2021
@cmaglie cmaglie deleted the pluggable-monitor-flags branch October 6, 2021 12:16
d-a-v pushed a commit to d-a-v/arduino-cli that referenced this pull request Oct 14, 2021
* Added silent mode for monitor

* Added --config flag to monitor command

* fix i18n

* Applied review suggestions

* rename --silent to --quiet
* removed useless 'settings' variable
* translation string for "Monitor port settings" in CLI mode
d-a-v pushed a commit to d-a-v/arduino-cli that referenced this pull request Oct 14, 2021
* Added silent mode for monitor

* Added --config flag to monitor command

* fix i18n

* Applied review suggestions

* rename --silent to --quiet
* removed useless 'settings' variable
* translation string for "Monitor port settings" in CLI mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants